package com.shenhua.kunpeng.db;

import com.shenhua.kunpeng.utils.DynamicDataSourceContextHolder;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        String lookupKey = DynamicDataSourceContextHolder.get();
        logger.debug("切换数据源:"+lookupKey);
        return lookupKey;
    }
}
